cmake_minimum_required(VERSION 3.16)

set(project_name BAT_PB)
set(bin_project_ver 1.0)
message(STATUS "project name    : ${project_name}  | $ENV{BUILD_UPDATE_FILE} | ")

if($ENV{BUILD_UPDATE_FILE})
    message(STATUS "project version : ${bin_project_ver} + 0.1")
else()
    file(WRITE ${CMAKE_SOURCE_DIR}/version.txt ${bin_project_ver})
endif()
if("${PROJECT_VER}" STREQUAL "")
    set(PROJECT_VER ${bin_project_ver})
endif()
message(STATUS "project version : ${PROJECT_VER} | ${bin_project_ver}")

#   生产环境, 屏蔽所有测试代码
if($ENV{BUILD_PRODUCTION})
    add_definitions(-DENV_PRODUCTION)
endif()

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(${project_name})
